package com.sdx.console.activity.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.admin.core.util.ValidateConfig;
import com.sdx.common.utils.Utils;
import lombok.Data;
import org.beetl.sql.core.annotatoin.AutoID;

import javax.validation.constraints.NotNull;
import java.util.Date;

/* 
* 
* gen by Spring Boot2 Admin 2019-05-27
*/
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@Data
public class ActivityCustomer extends BaseEntity{

    //活动会员id
    @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
    @AutoID	
    private Integer actCustId ;
	
    //可用标记 1、可用，0、不可用
    private Integer actCustStatus ;
	
    //活动id
    private Integer actId ;
	
    //会员id
    private String customerId ;
	
    //首次登录时间
    private Date createdTime ;
	
    //当日可用祝福次数 减为0时，则不可再发祝福
    private Integer remainCount ;
	
    //额外可用祝福次数 减为0时，则不可再发祝福
    private Integer extraCount ;
	
    //可用点赞数 减为0时，则不可再点赞
    private Integer upCount ;
	
    //最近登录时间
    private Date lastLogin ;

    private String customerName;

    private String actName;

    private String dateTimeQuery;

    private Date startTime;

    private Date endTime;

    public void setDateTimeQuery(String dateTimeQuery) {
        this.dateTimeQuery = dateTimeQuery;
        Date[] timePair = Utils.parseQueryTime(dateTimeQuery);
        if (timePair!=null && timePair[0]!=null) {
            this.startTime = timePair[0];
        }
        if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
            this.endTime = timePair[1];
        }
    }
}
